import 'package:dk_flutter_base/dk_core.dart';
import 'package:event_bus/event_bus.dart';

///该混入为了给PageBloc或者其他Bloc提供EventBus
///* 会自动注销无需手动注销
mixin EventBusBloc<Event, State> on Bloc<Event, State> {
  EventBus _eventBus;

  EventBus get eventBus =>
      objNotEmpty(_eventBus) ? _eventBus : _eventBus = EventBus();

  @override
  void dispose() {
    _eventBus?.destroy();
    super.dispose();
  }
}
